/*
 * MusicCellRenderer.java
 *
 * Created on August 8, 2007, 9:29 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.bff.bjj.ui.component;

import com.bff.mpd.musicjukebox.lib.ColorProperties;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

/**
 *
 * @author Bill
 */
public abstract class MusicListCellRenderer extends DefaultListCellRenderer {
    
    /** Creates a new instance of MusicCellRenderer */
    public MusicListCellRenderer() {
        setOpaque(false);
    }
    
    protected void setColors(JList list, int row, boolean isSelected) {
        if (isSelected) {
            setForeground(ColorProperties.LIST_FOREGROUND_SELECTED);
            setBackground(ColorProperties.LIST_BACKGROUND_SELECTED);
        } else {
            setForeground(ColorProperties.LIST_FOREGROUND);
            if ( (row % 2) == 0) {
                setBackground(ColorProperties.LIST_BACKGROUND_EVEN);
            } else {
                setBackground(ColorProperties.LIST_BACKGROUND_ODD);
            }
        }
        setOpaque(true);
    }
}
